﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Panaglobe.Silverlight.PhotoBrowser.Server;

/// <summary>
/// This is the panel that can display an existing photo album.
/// This class is derrived from <see cref="PhotoAlbumDisplayBase"/>
/// therefore the list page can cast and manipulate this instance.
/// </summary>
public partial class PhotoAlbumDisplay : PhotoAlbumDisplayBase
{
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    /// <summary>
    /// Called when the album to display has changed.
    /// </summary>
    /// <param name="oldAlbum">The old album.</param>
    /// <param name="newAlbum">The new album.</param>
    protected override void OnAlbumChanged(AlbumInfo oldAlbum, AlbumInfo newAlbum)
    {
        base.OnAlbumChanged(oldAlbum, newAlbum);

        this.albumTitleLink.HRef = "PhotoBrowser.aspx?ID=" + newAlbum.ID;
        this.albumTitleLink.InnerText = newAlbum.Title;
        this.albumLink.HRef = this.albumTitleLink.HRef;
        if (newAlbum.HasThumbnail)
        {
            this.imageLink.HRef = this.albumTitleLink.HRef;
            this.thumbnail.Src = "AlbumThumbnail.aspx?ID=" + newAlbum.ID;
            
        }
        this.thumbnailCell.Visible = newAlbum.HasThumbnail;
        this.descriptionLine.InnerText = newAlbum.Description;

    }
}
